import { useContext } from "react";
import "./index.css";
import AiChatContext from "@/common/context/aiChatContext.js";

const ChatManager = () => {
  const context = useContext(AiChatContext);

  const handleClickSession = (sessionId) => {
    context.requestHistoryChat(sessionId);
  };

  return (
    <div className="chat-manager">
      {context.sessionList.map((item) => {
        return (
          <div key={item.session_id} className="conversation-item" onClick={() => handleClickSession(item.session_id)}>
            {item.session_title}
          </div>
        );
      })}
    </div>
  );
};
export default ChatManager;
